<template>
  <div class="backTop_box">
    <div class="wra_back">
      <img
        src="http://img62.ddimg.cn/upload_img/00862/ntouch/top-1612179104.png"
         @click="backFun"
      />
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    backFun() {
    //   console.log(111);
      let top = document.documentElement.scrollTop || document.body.scrollTop;
      const timer = setInterval(() => {
        document.body.scrollTop =
          document.documentElement.scrollTop =
          top -=
            50;
        if (top <= 0) {
          clearInterval(timer);
        }
      }, 20);
    },
  },
};
</script>

<style lang="less" scoped>
.wra_back {
  position: fixed;
  right: 3px;
  bottom: 75px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(136, 136, 136, 0.5);
  border-radius: 50%;
  z-index: 9;
  overflow: hidden;
  img {
    width: 100%;
  }
}
</style>